<template>
  <div class="detail-action">
    <div class="state">
      <span class="iconfont icon-order-unpay"></span>
      <p>{{formatPayStatus[order.status]}}</p>
    </div>
    <div class="info">
      <p>订单编号：{{order.orderNo}}</p>
      <p>下单时间：{{order.createTime}}</p>
    </div>
    <div class="btn">
      <!-- 待付款 -->
      <template v-if="order.status === 0">
        <el-button @click="$router.push(`/pay?id=${order.id}`)" type="primary" size="small">立即付款</el-button>
<!--        <el-button type="primary" size="small">取消订单</el-button>-->
      </template>
      <!-- 待发货 -->
<!--      <template v-if="order.status === 1">-->
<!--        <el-button @click="$router.push(`/checkout?orderId=${order.id}`)" type="primary" size="small">再次购买</el-button>-->
<!--      </template>-->
      <!-- 待收货 -->
      <template v-if="order.status === 2">
<!--        <el-button type="primary" size="small">确认收货</el-button>-->
        <el-button  @click="$router.push(`/checkout?orderId=${order.id}`)" type="plain" size="small">再次购买</el-button>
      </template>
      <!-- 待评价 -->
<!--      <template v-if="order.status === 3">-->
<!--        <el-button  @click="$router.push(`/checkout?orderId=${order.id}`)" type="primary" size="small">再次购买</el-button>-->
<!--        <el-button type="primary" size="small">评价商品</el-button>-->
<!--&lt;!&ndash;        <el-button type="primary" size="small">申请售后</el-button>&ndash;&gt;-->
<!--      </template>-->
      <!-- 已完成 -->
<!--      <template v-if="order.status === 4">-->
<!--        <el-button  @click="$router.push(`/checkout?orderId=${order.id}`)" type="primary" size="small">再次购买</el-button>-->
<!--        <el-button type="primary" size="small">查看评价</el-button>-->
<!--&lt;!&ndash;        <el-button type="primary" size="small">申请售后</el-button>&ndash;&gt;-->
<!--      </template>-->
      <!-- 已取消 -->
    </div>
<!--    <Teleport to="#model">-->
<!--      <OrderCancel ref="orderCancelCom"/>-->
<!--    </Teleport>-->
  </div>
</template>
<script setup>
defineProps({
  order:{
    type: Object,
    default: () =>{ }
  }
})

const formatPayStatus = (payState) => {
  const stateMap = {
    0: '待付款',
    1: '待发货',
    2: '待收货',
    3: '待评价',
    4: '已完成',
    5: '已取消'
  }
  return stateMap[payState]
}
</script>
<style scoped lang="scss">
.detail-action {
  height: 180px;
  width: 100%;
  display: flex;
  align-items: center;
  .state {
    width: 220px;
    text-align: center;
    .iconfont {
      font-size: 40px;
      color: #27BA9B;
    }
    p {
      font-size: 16px;
      color: #666;
      margin-bottom: 10px;
    }
  }
  .info {
    width: 240px;
    line-height: 30px;
    p {
      color: #999;
    }
  }
  .btn {
    flex: 1;
    text-align: right;
    margin-right: 100px;
    .xtx-button {
      margin-left: 20px;
    }
  }
}
</style>